package com.tongtech.space.common.enums;

/**
 * 用户类型枚举类
 *
 * @author jinjiayu
 * @since 2021/1/14
 */
public enum UserTypeEnums {

    /**
     * 0自然人, 1法人
     */
    NATURE_PERSON(0, "自然人"),
    LEGAL_PERSON(1, "法人"),
    ;

    private int code;

    private String des;

    UserTypeEnums(int code, String des) {
        this.code = code;
        this.des = des;
    }

    public static UserTypeEnums getByCode(int code) {
        for (UserTypeEnums type : UserTypeEnums.values()) {
            if (code == type.getCode()) {
                return type;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

}
